<?php
/**
 * Created by PhpStorm.
 * User: peter
 * Date: 2018/10/12
 * Time: 上午10:16
 */

namespace app\activity\controller;


use app\activity\logic\Activity;
use app\activity\logic\Configure;
use think\Request;

class Home extends Base
{
    /**
     * @purpose 获取首页活动数据
     * @return array
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public function activity (Request $request)
    {
        $lng        = $request->get('lng', 104.045522);
        $lat        = $request->get('lat', 30.544916);
        $page       = $request->get('page', 1);
        $size       = $request->get('size', 50);
        $kw         = $request->get('kw');
        return Activity::homeItems($page, $size,$lng, $lat, $kw);
    }

    /**
     * @purpose 获取首页轮播图
     * @return array
     */
    public function slide ()
    {
        return  Configure::getConfigure('activity_swiper');
    }
}